//
//  IRTCSDK.h
//  ivcs_ios_demo
//
//  Created by zealcomm user on 2020/10/24.
//  Copyright © 2020 zealcomm user. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <IRTC/IRTC.h>
#import "MediaStreamSettingOptions.h"
#import <WebRTC/WebRTC.h>
NS_ASSUME_NONNULL_BEGIN

@protocol IRTCSDKDelegate <NSObject>

/// 房间有流需要渲染，已存在的流/新增的流
/// @param label 流标签
/// @param stream 流对象
-(void)onStreamAddWithLabel:(NSString *)label andStream:(IRTCRemoteStream *)stream;

/// 房间的流结束
/// @param label 流标签
/// @param stream 流对象
-(void)onStreamRemoveWithLabel:(NSString *)label andStream:(IRTCRemoteStream *)stream;

@end


@interface IRTCSDK : NSObject

@property (nonatomic,weak) id<IRTCSDKDelegate>delegate;

/// selfId in mcu room
@property(nonatomic,copy)NSString *participantId;

/// 实例化
+ (instancetype)shareSDK;


/// 加入room
/// @param token roomToken
/// @param success 成功，返回房间信息
/// @param failure 失败
-(void)joinRoomWithToken:(NSString *)token
                 onSuccess:(void (^)(IRTCConferenceInfo *info))success
                 onFailure:(void (^)(NSError *error))failure;



/// 推送本地流到mcu
/// @param label 流标签
/// @param options 推送参数
/// @param success 成功
/// @param failure 失败
-(void)publishLocalStreamToRoomWithStreamLabel:(nullable NSString *)label
                     mediaStreamSettingOptions:(MediaStreamSettingOptions *)options
                     onSuccess:(void (^)(IRTCLocalStream *localStream,IRTCConferencePublication *publication))success
                     onFailure:(void (^)(NSError *error))failure;



/// 订阅远端流
/// @param label 流标签
/// @param remoteStream 远端流对象
/// @param success 成功
/// @param failure 失败
-(void)subscribeStreamWithLabel:(nullable NSString *)label
                IRTCRemoteStream:(IRTCRemoteStream *)remoteStream
                onSuccess:(void (^)(IRTCConferenceSubscription *subscription))success
                onFailure:(void (^)(NSError *error))failure;

/// 切换摄像头
/// @param position 指定切换的方向，nil则切换为和上次相反的方向
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)switchCameraDevicePosition:(AVCaptureDevicePosition)position
                        onSuccess:(void (^)(void))onSuccess
                        onFailure:(void (^)(NSError *error))onFailure;



/// 离开房间
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)leaveRoomSuccess:(void (^)(void))onSuccess
                onFailure:(void (^)(NSError *error))onFailure;



/// 停止本地视频的声音/视频画面推送
/// @param type audio/video
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)muteWithMediaType:(IRTCTrackKind)type
            onSuccess:(void (^)(void))onSuccess
            onFailure:(void (^)(NSError *error))onFailure;


/// 恢复本地视频的声音/视频画面推送
/// @param type audio/video
/// @param onSuccess 成功
/// @param onFailure 失败
-(void)unmuteWithMediaType:(IRTCTrackKind)type
            onSuccess:(void (^)(void))onSuccess
            onFailure:(void (^)(NSError *error))onFailure;

@end

NS_ASSUME_NONNULL_END
